package br.cin.ufpe.feedbacktest.core;

import java.util.Random;

public class RandomFactory {
	
	private static final Random random = new Random(System.currentTimeMillis());
	
	private static final double[]  decimalPool = { -10.0, -5.0, 0.0, 5.0, 10.0 };
	private static final int[]     intPool = { -3, -2, -1, 0, 1, 2, 3 };
	private static final char[]    charPool = { 'a', 'b', 'c', 'd', 'e' };
	private static final boolean[] boolPool = { true, false };
	
	public static double randomDecimal() {
		int randomIndex = Math.abs(random.nextInt()) % decimalPool.length;
		return decimalPool[randomIndex];
	}

	public static int randomNumber() {
		int randomIndex = Math.abs(random.nextInt()) % intPool.length;
		return intPool[randomIndex];
	}

	public static char randomChar() {
		int randomIndex = Math.abs(random.nextInt()) % charPool.length;
		return charPool[randomIndex];
	}

	public static boolean randomBoolean() {
		int randomIndex = Math.abs(random.nextInt()) % boolPool.length;
		return boolPool[randomIndex];
	}
	
	public static int randomNumberBetween(int start, int end) {
		if ((end - start) == 0)return 0;		
		return (Math.abs(random.nextInt()) % (end - start)) + start;
	}

}
